<?php
include_once "config.php";
$id = $_POST['id'];
$title = $_POST['title'];
$name = $_POST['name'];
$email = $_POST['email'];
$info = $_POST['info'];
$sql = "INSERT INTO lyb (
id ,
title ,
name ,
email ,
info
)
VALUES ( 
'$id','$title', '$name' , '$email' , '$info')";
$result = $conn->query($sql);

   

?>
<?php   
include_once "config.php";     

$sql = "SELECT * FROM  lyb";
$result = $conn->query($sql);

$arrlist = array();

if ($result->num_rows > 0) {  
    // 输出每行数据
    while($row = $result->fetch_assoc()) {
        array_push($arrlist, $row);        
    }
} else {
    echo "0 results";
}


$conn->close();          
           ?>            
<?php
foreach ($arrlist as $vo){
?>
<style type="text/css">
.keleyitable {  
width: 800px;  
}  
.keleyitable table, td, th {  
border: 1px solid green;margin-top:10px;  
}  
.klytd {width:100px;text-align:right  
}  
.hvttd {  
width:500px} 
</style>
         

<div style="margin:0px auto;" class="keleyitable"><h2>留言一览</h2>
<table>  
<tr><td class="klytd">留言时间：</td><td class="hvttd"><?php  echo $vo['id']; ?></td></tr>  
<tr><td class="klytd">留言人：</td><td class="hvttd"><?php  echo $vo['title']; ?></td></tr>  
<tr><td class="klytd">标题：</td><td class="hvttd"><?php  echo ($vo[ 'name']); ?></td></tr>  
<tr><td class="klytd">内容：</td><td class="hvttd"><?php  echo $vo['email']; ?></td></tr>  
<tr><td class="klytd">回复：</td><td class="hvttd"><?php  echo $vo['info']; ?></td></tr>  
</table>    
</div>
<?php    }   ?>
<p>留言成功</p>
<p><a href="index.php">继续留言</a></p>